package io.starteos.wallet.utils.eos.data.remote.model.types;

import com.google.gson.annotations.Expose;

import io.starteos.wallet.utils.eos.crypto.util.HexUtils;
import io.starteos.wallet.utils.eos.data.remote.model.types.EosType.Writer;

public class Eosdelegatebw implements EosType.Packer{
	
	
	@Expose
	private TypeAccountName account_name;
	
	@Expose
	private TypeAsset net;
	
	@Expose
	private TypeAsset cpu;
	@Expose
	private TypeCoins duration;
	
	
	public Eosdelegatebw(String account_name, String net, String cpu, String duration) {
		this.account_name = new TypeAccountName(account_name);
		this.net = new TypeAsset(net);
		this.cpu = new TypeAsset(cpu);
		this.duration = new TypeCoins(duration);
	}


	public String getActionName() {
		return "delegatebw";
	}
	
	@Override
	public void pack(Writer writer) {
		account_name.pack(writer);
		net.pack(writer);
		cpu.pack(writer);
		duration.pack(writer);
	}
	public String getAsHex() {
		EosType.Writer writer = new EosByteWriter(512);
		pack(writer);
		return HexUtils.toHex(writer.toBytes());
	}
}
